﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DAL;

namespace BLL
{
    public class ForAmend
    {
        //获取登录的管理员账户旧密码
        public string LoginPwd()
        {
            string sql = @"select Pwd from Admin where ManageID=" + StaticStore.managerID;
            return DBHelper.ExecuteScalar(sql).ToString();
        }
        //更改指定管理员账户密码
        public string ChangePwd(string ManageID, string Pwd)
        {
            string sql = string.Format(@"update Admin set Pwd = '{0}' where ManageID = {1}", Pwd, ManageID);
            try
            {
                int jg = DBHelper.ExecuteNonQuery(sql);
                if (jg > 0)
                {
                    return "修改成功！";
                }
                else
                {
                    return "修改失败！";
                }
            }
            catch(Exception ex)
            {
                return ex.Message;
            }
        }
    }
}
